/**
 * Copyright (c) 2012-2014 All Rights Reserved.
 */
package com.easy.framwork.exceptions;

/**
 * 基础的异常
 * 
 * @author wy
 * @version v 0.1 2014-1-1 下午5:10:24 wy Exp $
 */
public class EasyException extends RuntimeException {

    /**  */
    private static final long serialVersionUID = -706220784568950173L;

    /** 异常编码 */
    private String errorCode;

    /** 异常信息 */
    private String message;

    /**
     * 
     * @param errorCode
     * @param message
     */
    public EasyException(String errorCode, String message) {
        super(message);
        this.message = message;
        this.errorCode = errorCode;
    }

    /**
     * 
     * @param errorCode
     * @param e
     */
    public EasyException(String errorCode, Throwable e) {
        super(e);
        this.message = e.getMessage();
        this.errorCode = errorCode;
    }

    /**
     * @param message
     */
    public EasyException(String message) {
        this("Unknown", message);
    }

    /**
     * Getter method for property <tt>errorCode</tt>.
     * 
     * @return errorCode
     */
    public String getErrorCode() {
        return errorCode;
    }

    /**
     * Getter method for property <tt>message</tt>.
     * 
     * @return message
     */
    @Override
    public String getMessage() {
        return errorCode + ":" + message;
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "EasyException [errorCode=" + errorCode + ", message=" + message + "]";
    }

}
